3.7.97 \(\int \frac {2-\sin (x)}{2+\sin (x)} \, dx\) [697]

Optimal. Leaf size=34 \[ -x+\frac {4 x}{\sqrt {3}}+\frac {8 \tan ^{-1}\left (\frac {\cos (x)}{2+\sqrt {3}+\sin (x)}\right )}{\sqrt {3}} \]

[Out]

-x+4/3*x*3^(1/2)+8/3*arctan(cos(x)/(2+sin(x)+3^(1/2)))*3^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.03, antiderivative size = 34, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.154, Rules used = {2814, 2736} \begin {gather*} \frac {8 \text {ArcTan}\left (\frac {\cos (x)}{\sin (x)+\sqrt {3}+2}\right )}{\sqrt {3}}+\frac {4 x}{\sqrt {3}}-x \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(2 - Sin[x])/(2 + Sin[x]),x]

[Out]

-x + (4*x)/Sqrt[3] + (8*ArcTan[Cos[x]/(2 + Sqrt[3] + Sin[x])])/Sqrt[3]

Rule 2736

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{q = Rt[a^2 - b^2, 2]}, Simp[x/q, x] + Simp
[(2/(d*q))*ArcTan[b*(Cos[c + d*x]/(a + q + b*Sin[c + d*x]))], x]] /; FreeQ[{a, b, c, d}, x] && GtQ[a^2 - b^2,
0] && PosQ[a]

Rule 2814

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[b*(x/d)
, x] - Dist[(b*c - a*d)/d, Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d
, 0]

Rubi steps

\begin {align*} \int \frac {2-\sin (x)}{2+\sin (x)} \, dx &=-x+4 \int \frac {1}{2+\sin (x)} \, dx\\ &=-x+\frac {4 x}{\sqrt {3}}+\frac {8 \tan ^{-1}\left (\frac {\cos (x)}{2+\sqrt {3}+\sin (x)}\right )}{\sqrt {3}}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.04, size = 28, normalized size = 0.82 \begin {gather*} -x+\frac {8 \tan ^{-1}\left (\frac {1+2 \tan \left (\frac {x}{2}\right )}{\sqrt {3}}\right )}{\sqrt {3}} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(2 - Sin[x])/(2 + Sin[x]),x]

[Out]

-x + (8*ArcTan[(1 + 2*Tan[x/2])/Sqrt[3]])/Sqrt[3]

________________________________________________________________________________________

Maple [A]
time = 0.07, size = 28, normalized size = 0.82

method result size
default \(-2 \arctan \left (\tan \left (\frac {x}{2}\right )\right )+\frac {8 \sqrt {3}\, \arctan \left (\frac {\left (2 \tan \left (\frac {x}{2}\right )+1\right ) \sqrt {3}}{3}\right )}{3}\) \(28\)
risch \(-x +\frac {4 i \sqrt {3}\, \ln \left ({\mathrm e}^{i x}+2 i+i \sqrt {3}\right )}{3}-\frac {4 i \sqrt {3}\, \ln \left ({\mathrm e}^{i x}+2 i-i \sqrt {3}\right )}{3}\) \(47\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((2-sin(x))/(2+sin(x)),x,method=_RETURNVERBOSE)

[Out]

-2*arctan(tan(1/2*x))+8/3*3^(1/2)*arctan(1/3*(2*tan(1/2*x)+1)*3^(1/2))

________________________________________________________________________________________

Maxima [A]
time = 0.53, size = 36, normalized size = 1.06 \begin {gather*} \frac {8}{3} \, \sqrt {3} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (\frac {2 \, \sin \left (x\right )}{\cos \left (x\right ) + 1} + 1\right )}\right ) - 2 \, \arctan \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((2-sin(x))/(2+sin(x)),x, algorithm="maxima")

[Out]

8/3*sqrt(3)*arctan(1/3*sqrt(3)*(2*sin(x)/(cos(x) + 1) + 1)) - 2*arctan(sin(x)/(cos(x) + 1))

________________________________________________________________________________________

Fricas [A]
time = 0.34, size = 27, normalized size = 0.79 \begin {gather*} \frac {4}{3} \, \sqrt {3} \arctan \left (\frac {2 \, \sqrt {3} \sin \left (x\right ) + \sqrt {3}}{3 \, \cos \left (x\right )}\right ) - x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((2-sin(x))/(2+sin(x)),x, algorithm="fricas")

[Out]

4/3*sqrt(3)*arctan(1/3*(2*sqrt(3)*sin(x) + sqrt(3))/cos(x)) - x

________________________________________________________________________________________

Sympy [A]
time = 0.28, size = 42, normalized size = 1.24 \begin {gather*} - x + \frac {8 \sqrt {3} \left (\operatorname {atan}{\left (\frac {2 \sqrt {3} \tan {\left (\frac {x}{2} \right )}}{3} + \frac {\sqrt {3}}{3} \right )} + \pi \left \lfloor {\frac {\frac {x}{2} - \frac {\pi }{2}}{\pi }}\right \rfloor \right )}{3} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((2-sin(x))/(2+sin(x)),x)

[Out]

-x + 8*sqrt(3)*(atan(2*sqrt(3)*tan(x/2)/3 + sqrt(3)/3) + pi*floor((x/2 - pi/2)/pi))/3

________________________________________________________________________________________

Giac [A]
time = 0.54, size = 51, normalized size = 1.50 \begin {gather*} \frac {4}{3} \, \sqrt {3} {\left (x + 2 \, \arctan \left (-\frac {\sqrt {3} \sin \left (x\right ) - \cos \left (x\right ) - 2 \, \sin \left (x\right ) - 1}{\sqrt {3} \cos \left (x\right ) + \sqrt {3} - 2 \, \cos \left (x\right ) + \sin \left (x\right ) + 2}\right )\right )} - x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((2-sin(x))/(2+sin(x)),x, algorithm="giac")

[Out]

4/3*sqrt(3)*(x + 2*arctan(-(sqrt(3)*sin(x) - cos(x) - 2*sin(x) - 1)/(sqrt(3)*cos(x) + sqrt(3) - 2*cos(x) + sin
(x) + 2))) - x

________________________________________________________________________________________

Mupad [B]
time = 7.83, size = 36, normalized size = 1.06 \begin {gather*} -x-\frac {8\,\sqrt {3}\,\mathrm {atan}\left (-\frac {\sqrt {3}\,\mathrm {tan}\left (\frac {x}{2}\right )-\sqrt {3}}{3\,\mathrm {tan}\left (\frac {x}{2}\right )+3}\right )}{3} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(-(sin(x) - 2)/(sin(x) + 2),x)

[Out]

- x - (8*3^(1/2)*atan(-(3^(1/2)*tan(x/2) - 3^(1/2))/(3*tan(x/2) + 3)))/3

________________________________________________________________________________________